package com.ishare.common.utils;

import java.util.Random;
import java.util.UUID;

/**
 * @author 李嘉宾
 */
public class RandomUtils {

    /**
     * 获取随机验证码
     *
     * @return 验证码
     */
    public static String randomCode() {
        StringBuilder builder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 4; i++) {
            builder.append(random.nextInt(10));
        }
        return builder.toString();
    }

    /**
     * 随机一个Token
     *
     * @return 随机Token
     */
    public static String randomToken() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
}
